package com.rongc.client.freight.business.carrier.model;

import android.content.Context;
import android.os.Bundle;

import com.rongc.client.core.utils.ActivityUtils;
import com.rongc.client.freight.business.carrier.view.activity.ConveyanceWaybillActivity;
import com.rongc.client.freight.business.carrier.view.activity.ConveyanceWaybillDetailActivity;
import com.rongc.client.freight.business.waybill.model.WayBillBean;
import com.rongc.client.freight.business.waybill.view.activity.WayBillNewActivity;

import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.CANEL_CZ_STATUS;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.CANEL_HZ_STATUS;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.COMPLATE_STATUS;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.DQR_STATUS;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.DTH_STATUS;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.DZF_STATUS;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.PDZ_TYPE;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.ROAD_STATUS;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.SH_STATUS;
import static com.rongc.client.freight.business.supply.model.SupplyDic.StatusType.YAJIN_STATUS;

/**
 * Created by Bruce on 2017/7/6.
 */
public class ConveyanceDic {
    /**
     * 返回值类型
     */
    public final static class ResultType {
        /** 车辆 */
        public static final int CAR_TYPE = 11;
        /** 出发地 */
        public static final int DEPARTURE_TYPE = 12;
        /** 目的地 */
        public static final int DESTINATION_TYPE = 13;
    }

    public static void jumpActivity(Context context, int status, WayBillBean data){
        switch (status){
            case PDZ_TYPE:
                Bundle bundle = new Bundle();
                bundle.putString("data",data.getTrucksId());
                ActivityUtils.startActivity(context,ConveyanceWaybillActivity.class,bundle);
                break;
            case DQR_STATUS:
            case DZF_STATUS:
                bundle = new Bundle();
                bundle.putString("waybillId",data.getOrderid());
                ActivityUtils.startActivity(context,ConveyanceWaybillDetailActivity.class,bundle);
                break;
            case YAJIN_STATUS:
            case DTH_STATUS:
            case ROAD_STATUS:
            case SH_STATUS:
            case COMPLATE_STATUS:
            case CANEL_CZ_STATUS:
            case CANEL_HZ_STATUS:
                bundle = new Bundle();
                bundle.putString("data",data.getOrderid());
                bundle.putInt("status",status);
                ActivityUtils.startActivity(context,WayBillNewActivity.class,bundle);
                break;
        }
    }

    public static int getNextStatus(int status){
        switch (status){
            case PDZ_TYPE:
            case DQR_STATUS:
            case DZF_STATUS:
                return YAJIN_STATUS;
            case YAJIN_STATUS:
                return DTH_STATUS;
            case DTH_STATUS:
                return ROAD_STATUS;
            case ROAD_STATUS:
                return SH_STATUS;
            case SH_STATUS:
                return COMPLATE_STATUS;
            case COMPLATE_STATUS:
                return CANEL_CZ_STATUS;
            default:
                return CANEL_CZ_STATUS;
        }
    }

    public static String getStatusTitle(int status){
        String statusStr = "";
        switch (status){
            case PDZ_TYPE:
            case DQR_STATUS:
            case DZF_STATUS:
                statusStr = "接单中";
                break;
            case YAJIN_STATUS:
            case DTH_STATUS:
            case ROAD_STATUS:
            case SH_STATUS:
                statusStr = "运单中";
                break;
            case COMPLATE_STATUS:
            case CANEL_CZ_STATUS:
            case CANEL_HZ_STATUS:
                statusStr = "运单详情";
                break;
        }
        return statusStr;
    }

    public static String getStatusStr(int status){
        String statusStr = "";
        switch (status){
            case PDZ_TYPE:
                statusStr = "接单中";
                break;
            case DQR_STATUS:
                statusStr = "待货主确认";
                break;
            case DZF_STATUS:
                statusStr = "待货主支付";
                break;
            case YAJIN_STATUS:
                statusStr = "待交押金";
                break;
            case DTH_STATUS:
                statusStr = "待提货";
                break;
            case ROAD_STATUS:
                statusStr = "运单中";
                break;
            case SH_STATUS:
                statusStr = "待收货";
                break;
            case COMPLATE_STATUS:
                statusStr = "已完成";
                break;
            case CANEL_CZ_STATUS:
                statusStr = "取消";
                break;
            case CANEL_HZ_STATUS:
                statusStr = "取消";
                break;
            default:
                statusStr = "运单详情";
                break;
        }

        return statusStr;
    }

    public static String getStatusBtn(int status){
        String statusStr = "";
        switch (status){
            case PDZ_TYPE:
                statusStr = "联系货主";
                break;
            case DQR_STATUS:
//                statusStr = "等待货主确认";
                break;
            case DZF_STATUS:
//                statusStr = "去支付";
                break;
            case YAJIN_STATUS:
                statusStr = "去交押金";
                break;
            case DTH_STATUS:
                statusStr = "确认提货";
                break;
            case ROAD_STATUS:
                statusStr = "确认货到";
                break;
            case SH_STATUS:
//                statusStr = "";
                break;
            case COMPLATE_STATUS:
                statusStr = "评论";
                break;
            case CANEL_CZ_STATUS:
//                statusStr = "取消";
                break;
            case CANEL_HZ_STATUS:
//                statusStr = "取消";
                break;
        }

        return statusStr;
    }


    public static boolean getStatusEnable(int status){
        boolean con = false;
        switch (status){
            case PDZ_TYPE:
            case DQR_STATUS:
            case DZF_STATUS:
                con = true;
                break;
            case YAJIN_STATUS:
            case DTH_STATUS:
            case ROAD_STATUS:
            case SH_STATUS:
            case COMPLATE_STATUS:
            case CANEL_CZ_STATUS:
            case CANEL_HZ_STATUS:
                con = false;
                break;
        }

        return con;
    }
}
